﻿using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

namespace BlueCMS.Core.Helpers
{
    public class Reflection
    {
        public static T CreateObject<T>(string assemblyAndClassName)
        {
            if (assemblyAndClassName.IndexOf(';') > 0)
            {
                string[] parts = assemblyAndClassName.Split(';');
                return CreateObject<T>(parts[1], parts[0]);
            }
            return CreateObject<T>(assemblyAndClassName, assemblyAndClassName);
        }
        public static T CreateObject<T>(string assemblyName, string className)
        {
            Assembly assembly = Assembly.Load(assemblyName);
            return (T)assembly.CreateInstance(className);
        }
    }
}
